#include <opencv2\opencv.hpp>
using namespace cv;
int main()
{
	Mat img = imread("image.jpg");
	Mat dst;

	//定义平移矩阵
	Mat M = cv::Mat::zeros(2, 3, CV_32FC1);
	M.at<float>(0, 0) = 1;
	M.at<float>(0, 2) = 100; //水平平移量
	M.at<float>(1, 1) = 1;
	M.at<float>(1, 2) = 50; //竖直平移量
	warpAffine(img, dst, M, Size(img.cols,img.rows));
	imshow("dst", dst);
	waitKey(0);
	return 0;
}